package file;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-08-07
 * Time: 7:59
 */
//删除文件
public class Demo03 {
    public static void main(String[] args) throws IOException {

        File file = new File("HelloWorld.txt");
        file.createNewFile();
        file.delete();  //立即删除文件
        file.deleteOnExit();//程序退出时删除 ( 可用于创建一些临时文件)
        System.out.println(file.exists());
    }
}
